fix(installer): detect existing Homebrew and persist shellenv#41
Merged
fullstackjam merged 1 commit intomainfrom Apr 21, 2026
Merged
fix(installer): detect existing Homebrew and persist shellenv#41fullstackjam merged 1 commit intomainfrom
fullstackjam merged 1 commit intomainfrom
Conversation
…profile When `curl | bash` was re-run in a fresh shell, `command -v brew` failed because Homebrew's PATH was never written to ~/.zprofile. The script then tried to reinstall Homebrew, which runs `chown -R /opt/homebrew` and fails on SIP-protected signed .app bundles in Caskroom (e.g. wetype). - Probe /opt/homebrew/bin/brew and /usr/local/bin/brew before reinstalling - Append `eval "$(brew shellenv)"` to ~/.zprofile after a fresh install so subsequent shells find brew on PATH - Replace manual PATH/HOMEBREW_* exports with `brew shellenv`
|
👋 Thanks for opening this pull request! Before merging:
@fullstackjam will review this soon. Thanks for contributing! 🚀 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a reinstall-loop bug in
scripts/install.shthat madecurl openboot.dev/<user> | bashfail on the second run.The bug
/opt/homebrew, but the installer script never wroteeval "$(brew shellenv)"to~/.zprofile— Homebrew's official installer only prints that as a hint.curl | bash),/opt/homebrew/binis not onPATH, socommand -v brewreturns false./opt/homebrewalready exists and executessudo chown -R ... /opt/homebrew.chownfails withOperation not permittedon SIP-protected signed.appbundles insideCaskroom/(e.g.wetype), andset -eaborts the whole script.Fix
/opt/homebrew/bin/brewand/usr/local/bin/brewbefore calling the Homebrew installer. If found,eval "$(brew shellenv)"and return.eval "$(/opt/homebrew/bin/brew shellenv)"to~/.zprofile(idempotent viagrep -qF) so future shells find brew onPATH.PATH/HOMEBREW_PREFIX/HOMEBREW_CELLAR/HOMEBREW_REPOSITORYexports withbrew shellenv, which is the canonical way.Test plan
curl openboot.dev/<user> | bashon a Mac with Homebrew already installed but not onPATH→ should detect it and skip reinstall.curl openboot.dev/<user> | bashon a fresh Mac without Homebrew → should install, add line to~/.zprofile, and not duplicate on re-run.~/.zprofiledoes not get duplicate entries across multiple runs.